package com.stu.design_patterns.proxy._03_dynamic_proxy_cglib;

import net.sf.cglib.proxy.Enhancer;

// 测试 cglib 动态代理
public class Client1 {
  public static void main(String[] args) {
    Person realObj = new Person();
    Enhancer enhancer = new Enhancer();
    enhancer.setSuperclass(realObj.getClass());
    enhancer.setCallback(new PersonInterceptor(realObj));
    Person proxyObj = (Person)enhancer.create();
    proxyObj.eat();
  }
}


